import React from 'react'
import {Route,Redirect} from 'react-router-dom';
function render(props){
  return <Profile {...props}/>
}
//render是一个渲染组件的方法
export default ({render,...others}) =>{
    // Route path component | render
    return (
        <Route   render={
            props=>{
                console.log('PrivateRouter,render');
                return localStorage.getItem('username')?render(props):<Redirect to="/login"/>;
            }
        }/>
    )
}